package cn.iocoder.yudao.module.trade.dal.mysql.brokerage;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.log.BrokerageLogPageReqVO;
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.log.AppBrokerageLogPageReqVO;
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.log.AppBrokerageLogRespVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageLogDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 佣金操作日志 Mapper
 *
 * @author JackChen
 */
@Mapper
public interface BrokerageLogMapper extends BaseMapperX<BrokerageLogDO> {

    default PageResult<BrokerageLogDO> selectPage(BrokerageLogPageReqVO reqVO) {

        return selectPage(reqVO, new LambdaQueryWrapperX<BrokerageLogDO>()
                .eqIfPresent(BrokerageLogDO::getUserId, reqVO.getUserId())
                .likeIfPresent(BrokerageLogDO::getUserName, reqVO.getUserName())
                .eqIfPresent(BrokerageLogDO::getPayPrice, reqVO.getPayPrice())
                .eqIfPresent(BrokerageLogDO::getFeePrice, reqVO.getFeePrice())
                .eqIfPresent(BrokerageLogDO::getTotalPrice, reqVO.getTotalPrice())
                .eqIfPresent(BrokerageLogDO::getType, reqVO.getType())
                .eqIfPresent(BrokerageLogDO::getAccountQrCodeUrl, reqVO.getAccountQrCodeUrl())
                //.eqIfPresent(BrokerageLogDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BrokerageLogDO::getRecords, reqVO.getRecords())
                .eqIfPresent(BrokerageLogDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(BrokerageLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BrokerageLogDO::getId));
    }

    default PageResult<BrokerageLogDO> selectPage(AppBrokerageLogPageReqVO reqVO) {

        return selectPage(reqVO, new LambdaQueryWrapperX<BrokerageLogDO>()
                .eqIfPresent(BrokerageLogDO::getUserId, reqVO.getUserId())
                .likeIfPresent(BrokerageLogDO::getUserName, reqVO.getUserName())
                .eqIfPresent(BrokerageLogDO::getPayPrice, reqVO.getPayPrice())
                .eqIfPresent(BrokerageLogDO::getFeePrice, reqVO.getFeePrice())
                .eqIfPresent(BrokerageLogDO::getTotalPrice, reqVO.getTotalPrice())
                .eqIfPresent(BrokerageLogDO::getType, reqVO.getType())
                .eqIfPresent(BrokerageLogDO::getAccountQrCodeUrl, reqVO.getAccountQrCodeUrl())
                //.eqIfPresent(BrokerageLogDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BrokerageLogDO::getRecords, reqVO.getRecords())
                .eqIfPresent(BrokerageLogDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(BrokerageLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BrokerageLogDO::getId));
    }
}